package cn.acewill.yxd.yunxundian.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import cn.acewill.yxd.yunxundian.R;
import cn.acewill.yxd.yunxundian.model.reportViewBean;

/**
 * Created by xxx on 2018/2/2.
 */

public class PreviewLostItemAdapter extends BaseAdapter{

    private Context context;
    private List<reportViewBean.ZhutiBean> zhutiList;
    public PreviewLostItemAdapter(){

    }
    @Override
    public int getCount() {
        return zhutiList!=null&&zhutiList.size()>0?zhutiList.size():0;
    }

    @Override
    public Object getItem(int position) {
        return zhutiList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView==null){
            convertView = LayoutInflater.from(context).inflate(R.layout.preview_lost_item,parent,false);
            holder = new ViewHolder();
            holder.indication = convertView.findViewById(R.id.indicator);
            holder.itemName = convertView.findViewById(R.id.itemScore);
            holder.islostItem = convertView.findViewById(R.id.islostItem);
            holder.dutyMen = convertView.findViewById(R.id.dutyMen);
            holder.itemScore = convertView.findViewById(R.id.itemScore);
            holder.endTime = convertView.findViewById(R.id.endTime);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }

        reportViewBean.ZhutiBean zhuti = zhutiList.get(position);
        holder.itemName.setText(zhuti.getXiaoxiangming());


        return convertView;
    }

    class ViewHolder{
        View indication;
        TextView islostItem;
        TextView itemName;
        TextView itemScore;
        TextView dutyMen;
        TextView endTime;
    }
}
